import Vue from 'vue'
import Router from 'vue-router'
Vue.use(Router)
import container from '@/views/container/container'

export const constantRouterMap = [{
        path: '',
        redirect: 'index',
        component: container,
        children: [{
            path: 'index',
            name: '首页',
            component: () =>
                import ('@/views/empty'),
            meta: {
                title: '首页',
                noCache: true,
                requireAuth: true
            }
        }]
    },
    {
        path: '/login',
        name: '登录',
        component: () =>
            import ('@/views/login')
    },
    {
        path: '/exorder',
        name: '样品管理',
        redirect: 'exorder',
        component: container,
        meta: {
            title: '样品申请',
            icon: 'home',
            noCache: true,
            requireAuth: true
        },
        children: [{
                path: '/empty',
                name: 'em',
                component: () =>
                    import ('@/views/empty')
            },
            {
                path: '/exapply',
                name: '样品申请',
                component: () =>
                    import ('@/views/order/exapply'),
                meta: {
                    title: '样品申请',
                    icon: 'home',
                    noCache: true,
                    requireAuth: true
                },
            },
            {
                path: '/addexapply',
                name: '申请',
                component: () =>
                    import ('@/views/order/addexapply'),
                meta: {
                    title: '申请',
                    icon: 'home',
                    noCache: true,
                    requireAuth: true
                },
            },
            {
                path: '/transportation',
                name: '物流',
                component: () =>
                    import ('@/views/order/transportation'),
                meta: {
                    title: '物流',
                    icon: 'home',
                    noCache: true,
                    requireAuth: true
                },
            },
            {
                path: '/exorder',
                name: '样品订单',
                component: () =>
                    import ('@/views/order/exorder'),
                meta: {
                    title: '样品订单',
                    icon: 'home',
                    noCache: true,
                    requireAuth: true
                },
            },
            {
                path: '/exorderDetail',name: '样品订单详情',
                component: () =>
                    import ('@/views/order/exorderDetail'),
                meta: {
                    title: '样品订单详情',
                    icon: 'home',
                    noCache: true
                },
            },
            {
                path: '/exorderDetail2',name: '样品订单详情2',
                component: () =>
                    import ('@/views/order/exorderDetail2'),
                meta: {
                    title: '样品订单详情',
                    icon: 'home',
                    noCache: true
                },
            },
            {
                path: '/exorderDetail3',name: '客户信息详情',
                component: () =>
                    import ('@/views/order/exorderDetail3'),
                meta: {
                    title: '客户信息详情',
                    icon: 'home',
                    noCache: true
                },
            },
            {
                path: '/exorderSendDetail',name: '样品订单详情',
                component: () =>
                import ('@/views/order/exorderSendDetail'),
                meta: {
                    title: '样品订单详情',
                    icon: 'home',
                    noCache: true
                },
            },
            {
                path: '/exorderDetail4',name: 'AML出货详情',
                component: () =>
                    import ('@/views/order/exorderDetail4'),
                meta: {
                    title: 'AML出货详情',
                    icon: 'home',
                    noCache: true
                },
            }
        ]
    },
    {
        path: '/amlProduct',
        name: 'AML规格分析',
        redirect: 'amlProduct',
        component: container,
        meta: {
            title: 'amlP',
            icon: 'home',
            noCache: true,
            requireAuth: true
        },

        children: [{
            path: '/amlProduct',
            name: 'AML规格分析',
            component: () =>
                import ('@/views/material/amlProduct'),
            meta: {
                title: 'AML规格分析',
                icon: 'home',
                noCache: true,
                requireAuth: true
            },
        }]
    },
    {
        path: '/BuyingData',
        name: 'AML客服聊天',
        redirect: 'BuyingData',
        component: container,
        meta: {
            title: 'amlB',
            icon: 'home',
            noCache: true,
            requireAuth: true
        },
        children: [{
            path: '/BuyingData',
            name: 'AML客服聊天',
            component: () =>
                import ('@/views/amlorder/community'),
            meta: {
                title: 'AML客服聊天',
                icon: 'home',
                noCache: true
            },
        }]
    },   
    {
        path: '/ShipmentData',
        name: 'AML出货数据',
        redirect: 'ShipmentData',
        component: container,
        meta: {
            title: 'amlS',
            icon: 'home',
            noCache: true,
            requireAuth: true
        },
        children: [{
            path: '/ShipmentData',
            name: 'AML出货数据',
            component: () =>
                import ('@/views/Shipment/makeup'),
            meta: {
                title: 'AML出货数据',
                icon: 'home',
                noCache: true
            },
        }]
    },  
    {
        path: '/InventoryData',
        name: '库存数据',
        redirect: 'InventoryData',
        component: container,
        meta: {
            title: '库存数据',
            icon: 'home',
            noCache: true,
            requireAuth: true
        },
        children: [{
            path: '/InventoryData',
            name: 'AML库存数据',
            component: () =>
                import ('@/views/Inventory/InventoryData'),
            meta: {
                title: 'AML库存数据',
                icon: 'home',
                noCache: true,
                requireAuth: true
            },
        },{
            path: '/addSeries',
            name: '库存数据信息',
            component: () =>
                import ('@/views/Inventory/addSeries'),
            meta: {
                title: '库存数据信息',
                icon: 'home',
                noCache: true
            },
        },{
            path: '/uppdf',
            name: '上传pdf',
            component: () =>
                import ('@/views/Inventory/uppdf'),
            meta: {
                title: '上传pdf',
                icon: 'home',
                noCache: true
            },
        }]
    },     
    {
        path: '/account',
        name: '运营管理',
        redirect: 'account',
        component: container,
        meta: {
            title: '运营管理',
            icon: 'home',
            noCache: true,
            requireAuth: true
        },

        children: [{
            path: '/account',
            name: 'AML客户信息',
            component: () =>
                import ('@/views/customerInfo/account'),
            meta: {
                title: 'AML客户信息',
                icon: 'home',
                noCache: true,
                requireAuth: true
            },
        }]
    },
    {
        path: '/community',
        name: '沟通管理',
        redirect: 'community',
        component: container,
        meta: {
            title: '沟通管理',
            icon: 'home',
            noCache: true,
            requireAuth: true
        },
        children: [{
            path: '/community',
            name: '用户沟通',
            component: () =>
                import ('@/views/support/community'),
            meta: {
                title: '用户沟通',
                icon: 'home',
                noCache: true,
                requireAuth: true
            },
        }]
    },
    {
        path: '/amlpromanage',
        name: 'AML物料管理',
        component: container,
        meta: {
            title: 'AML物料管理',
            icon: 'home',
            noCache: true,
            requireAuth: true
        },
        children: [{
            path: '/product',
            name: 'AML物料管理',
            component: () =>
                import ('@/views/pro/product'),
            meta: {
                title: 'AML物料管理',
                icon: 'home',
                noCache: true,
                requireAuth: true
            },
        },
        {
          path: '/addProduct',
          name: '物料',
          component: () => import('@/views/pro/addProduct'),
          meta: {
            title: '物料',
            icon: 'home',
            noCache: true
          }
        },
        {
          path: '/liaohao',
          name: '料号信息',
          component: () => import('@/views/pro/liaohao'),
          meta: {
            title: '料号信息',
            icon: 'home',
            noCache: true
          }
        }, 
    ]
    }
]

export default new Router({
    // 防止跳转路由时页面不是在顶部
    scrollBehavior() {
        return { x: 0, y: 0 }
    },
    routes: constantRouterMap
})